package org.nowcoder.huawei.other;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * HJ17: 坐标移动
 */
public class HJ17 {

    public static void hj17() throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String val = br.readLine();
        int x = 0;
        int y = 0;
        String[] split = val.split(";");
        for (String s : split) {
            if (s.length() >= 2) {
                String dir = String.valueOf(s.charAt(0));
                try {
                    int coor = Integer.parseInt(s.substring(1));
                    switch (dir) {
                        case "A":
                            x -= coor;
                            break;
                        case "D":
                            x += coor;
                            break;
                        case "W":
                            y += coor;
                            break;
                        case "S":
                            y -= coor;
                            break;
                        default:
                            break;
                    }
                } catch (NumberFormatException e) {
                    continue;
                }
            }
        }
        System.out.println(x + "," + y);
    }
}
